<template>
  <div class="xtx-bread">
    <div class="xtx-bread-item">
      <router-link to="/">首页</router-link>
      <i class="iconfont icon-angle-right"></i>
    </div>
    <div class="xtx-bread-item" v-for="item in parents" :key="item.path">
      <router-link :to="item.path">{{item.name}}</router-link>
      <i class="iconfont icon-angle-right"></i>
    </div>
    <div class="xtx-bread-curr">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'xtx-bread',
  props: {
    // 格式 [{path:'地址',name:'文字'}]
    parents: {
      type: Array,
      default: () => []
    }
  }
}
</script>

<style scoped lang='less'>
.xtx-bread {
  line-height: 1;
  padding: 30px 10px;
  &-item {
    display: inline;
    > a {
      color: #666;
      &:hover {
        color: @xtxColor;
      }
    }
    > i {
      color: #999;
      font-size: 12px;
      margin: 0 7px;
    }
  }
  &-curr {
    display: inline;
  }
}
</style>
